#include <iostream>
#include "contacts.pb.h"

int main ()
{
    contacts::contact conn;
    conn.set_sn(100001);
    conn.set_name("需爱你");
    conn.set_score(60.5);

    // 持久化的数据就放在了str，这个时候就可以对str进行持久化或网络传输
    std::string str = conn.SerializeAsString();

    contacts::contact stu;
    bool ret = stu.ParseFromString(str);
    if(ret == false)
    {
        std::cout << "序列化，反序列化失败" << std::endl;
        return -1;
    }
    std::cout << stu.sn() << std::endl;
    std::cout << stu.name() << std::endl;
    std::cout << stu.score() << std::endl;

    return 0;  
}